package com.example.readwrite;

import java.util.Arrays;
import java.util.concurrent.TimeUnit;

public class WriteTask implements Runnable {

    private SharedData sharedData;

    public WriteTask(SharedData sharedData) {
        this.sharedData = sharedData;
    }

    @Override
    public void run() {
        try {
            for (int i = 1; i < 27; i++) {
                char c = (char) (64 + i);
                sharedData.write(c);
                System.out.println("write = " + c);
                TimeUnit.SECONDS.sleep(1);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
